package com.mkh.st.admin.feign;

import com.mkh.st.admin.api.entity.SysTenant;
import com.mkh.st.admin.api.feign.ISysTenantProvider;
import com.mkh.st.admin.service.SysTenantService;
import com.mkh.st.common.core.util.R;
import com.mkh.st.common.security.annotation.Inner;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@AllArgsConstructor
public class SysTenantProvider implements ISysTenantProvider {

	private final SysTenantService sysTenantService;

	@Inner(value = false)
	@Override
	@GetMapping("/tenant/provider/list")
	public R<List<SysTenant>> list() {
		return R.ok(sysTenantService.getNormallist());
	}

	@Inner(value = false)
	@Override
	@GetMapping("/tenant/provider/getInfoById")
	public SysTenant getInfoById(@RequestParam("tenantId") Long tenantId) {
		return sysTenantService.getById(tenantId);
	}
}
